# json、retrofit 使用命令

path=""
needDelete=false #
#echo "例子：./runner_build.sh app t"
case $1 in
app)
  path="./app_library/"
  ;;
core)
  path="./lib_core/"
  ;;
ui)
  path="./lib_ui/"
  ;;
community)
  path="./business_community/"
  ;;
device)
  path="./business_device/"
  ;;
scene)
  path="./business_scene/"
  ;;
user)
  path="./business_user/"
  ;;
*)
  path=""
  ;;
esac
#echo "$path"

case $2 in
t)
  needDelete=true
  ;;
*)
  needDelete=false
  ;;
esac
#echo "$needDelete"

if [ "$path" = "" ]; then
  echo "选择择你需要生成代码的模块，如 ./runner_build.sh common 或 ./runner_build.sh common t"
  exit
fi

#cd $path

if [ $needDelete = true ]; then
  cd $path
  echo "flutter packages pub run build_runner build --delete-conflicting-outputs"
  flutter pub run build_runner build --delete-conflicting-outputs
  cd ..
else
  cd $path
  echo " flutter packages pub run build_runner build"
  flutter pub run build_runner build
  cd ..
fi
